﻿<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
				xmlns:msxml="urn:schemas-microsoft-com:xslt"
				xmlns:mv="urn:my-scripts">
	<xsl:output encoding="iso-8859-1" indent="yes" method="html" version="4.0" />
	<xsl:param name="filter" />
	<xsl:variable name="curnode" select="Results/ExportObject/ResourceManagementObject[ObjectIdentifier = $filter]/ResourceManagementAttributes/ResourceManagementAttribute" />

	<xsl:template match="/" >
			<table id="tData" style="font-family: Tahoma;font-size: 11px;border-top: #E6E6E6 1px solid;border-right: #E6E6E6 1px solid;border-left: #E6E6E6 1px solid;border-bottom: #E6E6E6 1px solid;">
				<xsl:call-template name="GeneralData" />
				<xsl:call-template name="ScopeData" />
				<xsl:call-template name="SystemScopingFilter" />
				<xsl:call-template name="RelationshipData" />
				<xsl:call-template name="RelationshipCriteriaData" />
				<xsl:call-template name="ParametersData" />
				<xsl:call-template name="InboundAttributeFlows" />
				<xsl:call-template name="InitialOutboundAttributeFlows" />
				<xsl:call-template name="ExistenceTests" />
				<xsl:call-template name="PersistentOutboundAttributeFlows" />
			</table>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display general data                                                                                                                            -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="GeneralData">
		<tr>
			<td style="font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: rgb(234,242,255);border-bottom: 1px solid rgb(120,172,255);">Synchronization Rule Configuration</td>
		</tr>
		<tr>
			<td>
				<table style="border: 0px;border-collapse:collapse;">
					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">Name</xsl:with-param>
						<xsl:with-param name="value" select="$curnode[AttributeName='DisplayName']/Value" />
					</xsl:call-template>

					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">Description</xsl:with-param>
						<xsl:with-param name="value" select="$curnode[AttributeName='Description']/Value" />
					</xsl:call-template>

					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">Created Time</xsl:with-param>
						<xsl:with-param name="value" select="substring-before($curnode[AttributeName='CreatedTime']/Value, ' ')" />
					</xsl:call-template>


					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">Precedence</xsl:with-param>
						<xsl:with-param name="value" select="$curnode[AttributeName='Precedence']/Value" />
					</xsl:call-template>

					<xsl:variable name="curval">
						<xsl:choose>
							<xsl:when test="$curnode[AttributeName='FlowType']/Value='1'">Outbound</xsl:when>
							<xsl:when test="$curnode[AttributeName='FlowType']/Value='0'">Inbound</xsl:when>
							<xsl:otherwise>
								<xsl:text>Inbound and Outbound</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">Data Flow Direction</xsl:with-param>
						<xsl:with-param name="value" select="$curval" />
					</xsl:call-template>


					<xsl:variable name="idval" select="$curnode[AttributeName='Dependency']/Value" />
					<xsl:variable name="dpstring" select="//ResourceManagementObject[ObjectIdentifier=$idval]/ResourceManagementAttributes/ResourceManagementAttribute[AttributeName='DisplayName']/Value" />

					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">Dependency</xsl:with-param>
						<xsl:with-param name="value" select="$dpstring" />
					</xsl:call-template>

					<!--======================================================================================================-->
					<!-- Apply Rule does only apply if SR is not inbound only                                                 -->
					<xsl:if test="$curnode[AttributeName='FlowType']/Value!='0'">
						<xsl:choose>
							<xsl:when test="$curnode[AttributeName='msidmOutboundIsFilterBased']/Value = 'False'">
								<xsl:call-template name="DataItem">
									<xsl:with-param name="type">Apply Rule</xsl:with-param>
									<xsl:with-param name="value">Policy-based Outbound Synchronization</xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:otherwise>
								<xsl:call-template name="DataItem">
									<xsl:with-param name="type">Apply Rule</xsl:with-param>
									<xsl:with-param name="value">Filter-based Outbound Synchronization</xsl:with-param>
								</xsl:call-template>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:if>
					<!--======================================================================================================-->

				</table>
			</td>
		</tr>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display scope data                                                                                                                              -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="ScopeData">
		<tr>
			<td style="font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: rgb(234,242,255);border-bottom: 1px solid rgb(120,172,255);">Scope</td>
		</tr>
		<tr>
			<td>
				<table style="border: 0px;border-collapse:collapse;">
					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">Metaverse Resource Type</xsl:with-param>
						<xsl:with-param name="value" select="$curnode[AttributeName='ILMObjectType']/Value" />
					</xsl:call-template>


					<xsl:variable name="idval" select="$curnode[AttributeName='ManagementAgentID']/Value" />
					<xsl:variable name="dsstring" select="//ResourceManagementObject[ObjectIdentifier=$idval]/ResourceManagementAttributes/ResourceManagementAttribute[AttributeName='DisplayName']/Value" />

					<xsl:variable name="dsname">
						<xsl:choose>
							<xsl:when test="string-length($dsstring)= 0">
								<xsl:value-of select="substring($idval, 10)" />
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$dsstring" />
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>

					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">External System</xsl:with-param>
						<xsl:with-param name="value" select="$dsname" />
					</xsl:call-template>

					<xsl:call-template name="DataItem">
						<xsl:with-param name="type">External System Resource Type</xsl:with-param>
						<xsl:with-param name="value" select="$curnode[AttributeName='ConnectedObjectType']/Value"  />
					</xsl:call-template>
				</table>
			</td>
		</tr>
	</xsl:template>

	<!--=============================================================================================================================================================-->
	<!-- Template to display relationship data                                                                                                                       -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="RelationshipData">
		<tr>
			<td style="font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: rgb(234,242,255);border-bottom: 1px solid rgb(120,172,255);">Relationship</td>
		</tr>
		<tr>
			<td>
				<table style="border: 0px;border-collapse:collapse;">
					<xsl:if test="$curnode[AttributeName='FlowType']/Value != '1'">
						<xsl:call-template name="DataItem">
							<xsl:with-param name="type">Create Resource In FIM</xsl:with-param>
							<xsl:with-param name="value" select="$curnode[AttributeName='CreateILMObject']/Value" />
						</xsl:call-template>
					</xsl:if>

					<xsl:if test="$curnode[AttributeName='FlowType']/Value != '0'">
						<xsl:call-template name="DataItem">
							<xsl:with-param name="type">Create Resource In External System</xsl:with-param>
							<xsl:with-param name="value" select="$curnode[AttributeName='CreateConnectedSystemObject']/Value" />
						</xsl:call-template>
						<xsl:call-template name="DataItem">
							<xsl:with-param name="type">Enable Deprovisioning</xsl:with-param>
							<xsl:with-param name="value" select="$curnode[AttributeName='DisconnectConnectedSystemObject']/Value" />
						</xsl:call-template>
					</xsl:if>
				</table>
			</td>
		</tr>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display the connected object scope                                                                                                             -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="SystemScopingFilter">
		<xsl:if test="count($curnode[AttributeName='ConnectedSystemScope'])&gt;0">
			<xsl:call-template name="DisplayScopingFilter">
				<xsl:with-param name="FilterType">Inbound System Scoping Filter</xsl:with-param>
				<xsl:with-param name="NodeList" select="mv:parse($curnode[AttributeName='ConnectedSystemScope']/Value)" />
			</xsl:call-template>
		</xsl:if>

		<xsl:if test="count($curnode[AttributeName='msidmOutboundScopingFilters'])&gt;0">
			<xsl:call-template name="DisplayScopingFilter">
				<xsl:with-param name="FilterType">Outbound System Scoping Filter</xsl:with-param>
				<xsl:with-param name="NodeList" select="mv:parse($curnode[AttributeName='msidmOutboundScopingFilters']/Value)" />
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display a scoping filte                                                                                                                         -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="DisplayScopingFilter">
		<xsl:param name="FilterType" />
		<xsl:param name="NodeList" />
		<tr>
			<td style="padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: #e9ffcb;border-bottom: 1px solid green;">
				<xsl:value-of select="$FilterType" />
			</td>
		</tr>
		<tr>
			<td>
				<table style="border: 0px;border-collapse:collapse;">
					<tr>
						<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Source Attribute</td>
						<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Operation</td>
						<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Value</td>
					</tr>
					<xsl:for-each select="$NodeList/scoping/scope" >
						<tr>
							<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
								<xsl:value-of select="csAttribute" />
							</td>
							<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
								<xsl:value-of select="csOperator" />
							</td>

							<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
								<xsl:value-of select="csValue" />
							</td>
						</tr>
					</xsl:for-each>
				</table>
			</td>
		</tr>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display relationships                                                                                                                           -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="RelationshipCriteriaData">
		<tr>
			<td style="font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: #e9ffcb;border-bottom: 1px solid green;">Relationship Criteria</td>
		</tr>
		<tr>
			<td>
				<table style="border: 0px;border-collapse:collapse;">
					<tr>
						<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Metaverse Attribute</td>
						<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Data Source Attribute</td>
					</tr>
					<xsl:variable name="relationshipNodes" select="mv:parse($curnode[AttributeName='RelationshipCriteria']/Value)" />
					<xsl:for-each select="$relationshipNodes/conditions/condition">
						<tr>
							<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
								<xsl:value-of select="ilmAttribute" />
							</td>
							<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
								<xsl:value-of select="csAttribute" />
							</td>
						</tr>
					</xsl:for-each>
				</table>
			</td>
		</tr>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display parameter                                                                                                                               -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="ParametersData">
		<xsl:if test="count($curnode[AttributeName='SynchronizationRuleParameters']/Values)&gt;0">
			<tr>
				<td style="font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: rgb(234,242,255);border-bottom: 1px solid rgb(120,172,255);">Parameters</td>
			</tr>
			<tr>
				<td>
					<table style="border: 0px;border-collapse:collapse;">
						<tr>
							<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">ILM Attribute</td>
							<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Data Source Attribute</td>
						</tr>
						<xsl:for-each select="$curnode[AttributeName='SynchronizationRuleParameters']/Values/sync-parameter">
							<tr>
								<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
									<xsl:value-of select="name" />
								</td>
								<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
									<xsl:value-of select="type" />
								</td>
							</tr>
						</xsl:for-each>
					</table>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display inbound attribute flows                                                                                                                 -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="InboundAttributeFlows">
		<xsl:if test="count($curnode[AttributeName='PersistentFlow']/Values/string[substring(.,2,6) = 'import'])&gt;0">	
			<tr>
				<td style="text-align: left;font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: rgb(234,242,255);border-bottom: 1px solid rgb(120,172,255);">Inbound Attribute Flows</td>
			</tr>
			<xsl:call-template name="DisplayFlowData">
				<xsl:with-param name="nodeset" select="$curnode[AttributeName='PersistentFlow']/Values/string[substring(.,2,6) = 'import']" />
				<xsl:with-param name="type" select="0" />
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display persistent outbound flows                                                                                                               -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="PersistentOutboundAttributeFlows">
		<xsl:if test="count($curnode[AttributeName='PersistentFlow']/Values/string[substring(.,2,6) = 'export'])&gt;0">
			<tr>
				<td style="text-align: left;font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: rgb(234,242,255);border-bottom: 1px solid rgb(120,172,255);">Persistent Outbound Attribute Flows</td>
			</tr>
			<xsl:call-template name="DisplayFlowData">
				<xsl:with-param name="nodeset" select="$curnode[AttributeName='PersistentFlow']/Values/string[substring(.,2,6) = 'export']" />
				<xsl:with-param name="type" select="1" />
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display initial outbound attribute flows                                                                                                        -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="InitialOutboundAttributeFlows">
		<xsl:if test="count($curnode[AttributeName='InitialFlow']/Values/string[substring(.,2,6) = 'export'])&gt;0">
			<tr>
				<td style="text-align: left;font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: rgb(234,242,255);border-bottom: 1px solid rgb(120,172,255);">Initial Outbound Attribute Flows</td>
			</tr>
			<xsl:call-template name="DisplayFlowData">
				<xsl:with-param name="nodeset" select="$curnode[AttributeName='InitialFlow']/Values/string[substring(.,2,6) = 'export']" />
				<xsl:with-param name="type" select="1" />
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display existence tests                                                                                                                         -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="ExistenceTests">
		<xsl:if test="count($curnode[AttributeName='ExistenceTest'])&gt;0">
			<tr>
				<td style="font-family: Tahoma;font-size: 11px;padding-top: 5px;padding-bottom: 5px;padding-left: 10px;padding-right: 10px;font-weight: bold;background: #e9ffcb;border-bottom: 1px solid green;">Existence Tests</td>
			</tr>
			<xsl:call-template name="DisplayFlowData">
				<xsl:with-param name="nodeset" select="$curnode[AttributeName='ExistenceTest']/Values/string[substring(.,2,6) = 'export']" />
				<xsl:with-param name="type" select="1" />
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display flow data                                                                                                                               -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="DisplayFlowData">
		<xsl:param name="type" />
		<xsl:param name="nodeset" />
		<tr>
			<td>
				<table style="border: 0px;border-collapse:collapse;">
					<tr>
						<xsl:if test="$type=1">
							<td style="text-align: left;font-family: Tahoma;font-size: 11px;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Allow Nulls</td>
						</xsl:if>
						<td style="font-family: Tahoma;font-size: 11px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Destination</td>
						<td style="font-family: Tahoma;font-size: 11px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">Source</td>
					</tr>
					<xsl:for-each select="$nodeset">
						<tr>
							<xsl:if test="(position() mod 2 = 0)">
								<xsl:attribute name="bgcolor">#EEEEFF</xsl:attribute>
							</xsl:if>
							<xsl:variable name="flowNode" select="mv:parse(.)" />
							<xsl:if test="$flowNode/child::node()[1]/@allows-null">
								<td style="font-family: Tahoma;font-size: 11px;text-align: center;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
									<xsl:value-of select="$flowNode/child::node()[1]/@allows-null" />
								</td>
							</xsl:if>
							<xsl:choose>
								<xsl:when test="$flowNode/child::node()[1][0 = count(fn)]">
									<xsl:call-template name="DirectFlow">
										<xsl:with-param name="curnode" select="$flowNode/child::node()[1]" 	/>
									</xsl:call-template>
								</xsl:when>
								<xsl:otherwise>
									<xsl:call-template name="CalculatedFlow">
										<xsl:with-param name="curnode" select="$flowNode/child::node()[1]" 	/>
									</xsl:call-template>
								</xsl:otherwise>
							</xsl:choose>

						</tr>
					</xsl:for-each>
				</table>
			</td>
		</tr>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display a direct flows                                                                                                                          -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="DirectFlow">
		<xsl:param name="curnode" />
		
		<td style="font-family: Tahoma;font-size: 11px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
			<xsl:value-of select="$curnode/dest" />
		</td>
		<td style="font-family: Tahoma;font-size: 11px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;">
			<xsl:choose>
				<xsl:when test="count($curnode/src/attr) != 0">
					<xsl:value-of select="$curnode/src/attr" />
				</xsl:when>
				<xsl:otherwise>
					<strong>
						<xsl:text>Constant: </xsl:text>
					</strong>
					<xsl:value-of select="$curnode/src" />
				</xsl:otherwise>
			</xsl:choose>
		</td>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display a calculated flows                                                                                                                      -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="CalculatedFlow">
		<xsl:param name="curnode" />
		<td style="font-family: Tahoma;font-size: 11px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;">
			<xsl:value-of select="$curnode/dest" />
		</td>
		<td style="font-family: Tahoma;font-size: 11px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal">
			<xsl:call-template name="DisplayFunction">
				<xsl:with-param name="curnode" select="$curnode" />
			</xsl:call-template> 
		</td>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display functions                                                                                                                               -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="DisplayFunction">
		<xsl:param name="curnode" />
		<xsl:if test="$curnode/fn/@isCustomExpression='true'">
			<strong>
				<xsl:text>CustomExpression(</xsl:text>
			</strong>
		</xsl:if>

		<strong>
			<xsl:value-of select="$curnode/fn/@id" />
			<xsl:text>(</xsl:text>
		</strong>
		<xsl:for-each select="$curnode/fn/arg">
			<xsl:call-template name="DisplayArgument" />
			<xsl:if test="not(position()=last())">
				<xsl:text>,</xsl:text>
			</xsl:if>
		</xsl:for-each>

		<strong>
			<xsl:text>)</xsl:text>
		</strong>

		<xsl:if test="$curnode/fn/@isCustomExpression='true'">
			<strong>
				<xsl:text>)</xsl:text>
			</strong>
		</xsl:if>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display arguments                                                                                                                               -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="DisplayArgument">
		<xsl:choose>
			<xsl:when test="./fn">
				<xsl:for-each select=".">
					<xsl:call-template name="DisplayFunction" />
				</xsl:for-each>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="." />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!--=============================================================================================================================================================-->
	<!-- Template to display a data item                                                                                                                             -->
	<!--=============================================================================================================================================================-->
	<xsl:template name="DataItem">
		<xsl:param name="type" />
		<xsl:param name="value" />
		<tr>
			<td style="font-family: Tahoma;font-size: 11px;text-align: left;padding-left: 10px;padding-right: 10px;padding-top: 2px;padding-bottom: 2px;font-weight: normal;white-space: nowrap;background-color:#E6E6E6;">
				<xsl:value-of select="$type" />
			</td>
			<td style="font-family: Tahoma;font-size: 11px;padding-left:5px;">
				<xsl:value-of select="$value" />
			</td>
		</tr>
	</xsl:template>
	<!--===================================================================================================================================-->
	<!-- Script to convert XML Text into XML Node List                                                                                     -->
	<!--===================================================================================================================================-->
	<msxml:script language="CSharp" implements-prefix="mv">
		<msxml:using namespace="System.IO" />
		public XPathNodeIterator parse(string data)
		{
		String xmlString = "&lt;root&gt;" + data + "&lt;/root&gt;";
		StringReader stringReader = new StringReader(xmlString);

		XPathDocument xPathDocument = new XPathDocument(stringReader);
		XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();

		return xPathNavigator.Select("root");
		}
	</msxml:script>
</xsl:stylesheet>
<!--==================================================================================================================================================================-->
